package kMesh;

import kGeom.kElement;

public class kGraphEdge extends kElement {
	public int si;
	public int ei;
	public int w;

	kGraphEdge(int startIndex, int endIndex, int weight) {
		this.si = startIndex;
		this.ei = endIndex;
		this.w = weight;
		
		if (si==ei){this.isValid = false;}
	}

	public void setWeight(int weight){
		w = weight;
	}
	public void gainWeight(int weight){
		w+=weight;
	}
	public void loseWeight(int weight){
		w-=weight;
	}
	
	boolean isIdentical(kGraphEdge e) {
		return (((this.si == e.si) && (this.ei == e.ei)) || ((this.ei == e.si) && (this.si == e.ei)));
	}
	
	void indexDownIfGreater(int index){
		if (si>index){si--;}
		if (ei>index){ei--;}
	}

}
